package operations;

import book.Book;
import book.BookList;
import java.util.Scanner;
public class DelOperation implements IOperation{
    public void work(BookList bookList){
        System.out.println("删除");
        System.out.println("请输入你要删除的书名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookList.usedSize; i++) {
            Book book = bookList.getPos(i);
            if (name.equals(book.getName())){
                System.out.println("有这个书，可以删除");
                break;
            }else {
                System.out.println("没有这本书，删除不了");
            }
        }
        bookList.del(name);
    }
}
